
    <script type="text/javascript">

        var <?php echo $colId;?> = new Ext.data.JsonStore({
            url: '<?php echo Boot::link('/admin/mongo/show_collect',array('collect'=>$collection)) ?>',
            root: 'root',
            id:'<?php echo $colId;?>',
//        autoDestroy: true,
            totalProperty:'totalProperty',
            fields: ['descn']
//        remoteSort:true
        });
        <?php echo $colId;?>.load({collect:'<?php echo $collection?>'});

        var grid2<?php echo $colId;?> = new Ext.grid.GridPanel({
            viewConfig:{forceFit:true},
            store:<?php echo $colId;?>,
            title:'<?php echo $colName;?>',
            stripeRows: true,
            id:"grid-<?php echo $colId;?>",

            columns:[
                new Ext.grid.RowNumberer(),
                {header:'descn',dataIndex:'descn'},
            ],
            tbar:new Ext.Toolbar([
                {
                    text: '添加',
                    data:{action:'add',col:'<?php echo $collection?>'},
                    handler: function(e){
                        var win = new Ext.Window({
//                            el:'window-win',
                            layout:'fit',
                            width:500,
                            height:300,
                            data:e,
                            closeAction:'close',
                            title:'添加的内容',

                            items: [{
                                xtype: 'textarea',
                                id:'col_edt_content',
                                fieldLabel: '添加的内容',
                                value: ''
                            }],

                            buttons: [{
                                text:'按钮',
                                data:e,
                                handler:function(e){
                                    var text ;
                                    console.log(e.data.data);
                                    text = Ext.get('col_edt_content').getValue();
                                    Ext.Ajax.request({
                                        url:"<?php echo Boot::link('/admin/mongo/edit') ?>",
                                        params:{
                                          doc:text,
                                          action:e.data.data.action,
                                          col:e.data.data.col
                                        },
                                        success:function(response,options){
                                            var o = Ext.util.JSON.decode(response.responseText);
                                            alert(o.msg);
                                            <?php echo $colId;?>.load({params:{name:"xx"}});
                                        },
                                        failure:''
                                    })
                                }
                            }]
                        });
                        win.show();
                    }
                },
                {

                    text: '删除',
                    data:{action:'delete',col:'<?php echo $collection?>'},
                    handler: function(e){
                        var win = new Ext.Window({
//                            el:'window-win',
                            layout:'fit',
                            width:500,
                            height:300,
                            data:e,
                            closeAction:'close',
                            title:'删除的条件',

                            items: [{
                                xtype: 'textarea',
                                id:'col_edt_content',
                                fieldLabel: '添加的内容',
                                value: ''
                            }],

                            buttons: [{
                                text:'按钮',
                                data:e,
                                handler:function(e){
                                    var text ;
                                    console.log("xx");
                                    console.log(e.data.data.action);
                                    console.log(e.data.data.col);
                                    text = Ext.get('col_edt_content').getValue();
                                    Ext.Ajax.request({
                                        url:"<?php echo Boot::link('/admin/mongo/edit') ?>",
                                        params:{
                                            doc:text,
                                            action:e.data.data.action,
                                            col:e.data.data.col,
                                            xx:"oo"
                                        },
                                        success:function(response,options){
                                            var o = Ext.util.JSON.decode(response.responseText);
                                            alert(o.msg);
                                            <?php echo $colId;?>.load();
                                        },
                                        failure:''
                                    })
                                }
                            }]
                        });
                        win.show();
                    }
                },
                {

                    text: '查找',
                    data:{action:'search',col:'<?php echo $collection?>'},
                    handler: function(e){
                        var win = new Ext.Window({
    //                            el:'window-win',
                            layout:'fit',
                            width:500,
                            height:300,
                            data:e,
                            closeAction:'close',
                            title:'查找的条件',

                            items: [{
                                xtype: 'textarea',
                                id:'col_edt_content',
                                fieldLabel: '添加的内容',
                                value: ''
                            }],

                            buttons: [{
                                text:'按钮',
                                data:e,
                                handler:function(e){
                                    var text ;
                                    console.log(e.data.data);
                                    text = Ext.get('col_edt_content').getValue();
                                    <?php echo $colId;?>.load({params:{"doc":text}});
                                }
                            }]
                        });
                        win.show();
                    }
                }

            ]),
            bbar:new Ext.PagingToolbar({
                pageSize:15,
                store:<?php echo $colId;?>
            }),
            autoHeight: true,
        });

        grid2<?php echo $colId;?>.on('rowdblclick', function (grid, rowIndex, e) {
            var record = grid.getStore().getAt(rowIndex);
            var value = record.get('descn');
            var win = new Ext.Window({
                layout:'fit',
                width:500,
                height:300,
                closeAction:'close',
                title:'预览',

                items: [{
                    xtype: 'textarea',
                    id:'col_edt_content',
                    fieldLabel: '添加的内容',
                    value:JSON.stringify(Ext.util.JSON.decode(value), null, "\t")
                }]


            });
            win.show();
        });
        Ext.getCmp('viewTab').get('<?php echo $collection?>').add(
            grid2<?php echo $colId;?>
            );
        Ext.getCmp('viewTab').doLayout();



    </script>
 <div id="collection-<?php echo $colId;?>"></div>

